package miniproj.models.groups;

import java.util.LinkedList;

import javax.xml.bind.annotation.*;

import miniproj.models.people.*;

public class Group implements java.io.Serializable {

	private static final long serialVersionUID = -7870076405291191989L;

	@XmlAttribute
	private String id;

	@XmlElement
	private LinkedList<Student> listStudents;

	/**
	 * Instantiates a new group. (JavaBeans)
	 */
	public Group() {
		this.id = "undefined";
		this.listStudents = new LinkedList<Student>();
	}

	/**
	 * Instantiates a new group.
	 * 
	 * @param id
	 *            the id of the group
	 */
	public Group(String id) {
		this.id = id;
		this.listStudents = new LinkedList<Student>();
	}

	/**
	 * Instantiates a new group.
	 * 
	 * @param id
	 *            the id of the group
	 * @param listStudents
	 *            the list of students in the group
	 */
	public Group(String id, LinkedList<Student> listStudents) {
		this.id = id;
		this.listStudents = listStudents;
	}

	/**
	 * Gets the id of the group.
	 * 
	 * @return the id of the group
	 */
	public String getId() {
		return this.id;
	}

	/**
	 * Gets the students of the group
	 * 
	 * @return the students of the group
	 */
	public LinkedList<Student> getStudents() {
		return this.listStudents;
	}

	@Override
	public boolean equals(Object o) {
		if (!(o instanceof Group))
			return false;

		return ((Group) o).getId().equals(this.id);
	}

	@Override
	public String toString() {
		return this.id;
	}
}
